#{extends 'CRUD/layout.html' /}
#{set title:messages.get('crud.title') /}

<script>
$(document).ready(function(){
	$("tbody tr").each(function() {
		$(this).removeClass("odd").removeClass("even");
		var link = $(this).find('.hiddenLinks').text();
		$(this).click(function(){
			$(location).attr("href", link);
		});
		$(this).hover(function () {
		    $(this).addClass("hover");
		  },
		  function () {
		    $(this).removeClass("hover");
		  });
	});	
});
</script>

<div id="crudIndex">

    <h2>&{'crud.index.title'}</h2>

    <table>
        <thead>
            <tr>
                <th>&{'crud.index.objectType'}</th>
                <th width="20%">&{'crud.index.action'}</th>
            </tr>
        </thead>
        <tbody>
#{crud.types}
            <tr>
                <td>
                	<span class="hiddenLinks">${type.listAction}</span>
                    &{'objects.' + type.name.toLowerCase()}
                </td>
                <td class="crudNew" >
                    <a href="${type.blankAction}">&{'crud.index.add', type}</a>
                </td>
            </tr>
#{/crud.types}
        </tbody>
    </table>

</div>
